package com.nexus.service.sys.service.mapstruct;


import com.nexus.core.service.mapstruct.BaseConverter;
import com.nexus.core.sys.dto.SysMessageDTO;
import com.nexus.core.sys.entity.SysMessage;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

/**
 * SysMessageWrapper
 *
 * @author yf
 * @version 2023-06-30
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
public interface SysMessageWrapper extends BaseConverter<SysMessage, SysMessageDTO> {

    SysMessageWrapper INSTANCE = Mappers.getMapper(SysMessageWrapper.class);

    @Mappings({
            @Mapping(source = "sendUser.id", target = "sendUser"),
            @Mapping(source = "receiveUser.id", target = "receiveUser"),
            @Mapping(source = "org.id", target = "org"),
            @Mapping(source = "createBy.id", target = "createBy"),
            @Mapping(source = "updateBy.id", target = "updateBy")})
    SysMessage toEntity(SysMessageDTO dto);

    @Mappings({
            @Mapping(source = "sendUser", target = "sendUser.id"),
            @Mapping(source = "receiveUser", target = "receiveUser.id"),
            @Mapping(source = "org", target = "org.id"),
            @Mapping(source = "createBy", target = "createBy.id"),
            @Mapping(source = "updateBy", target = "updateBy.id")})
    SysMessageDTO toDTO(SysMessage entity);
}

